/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TabbedPane.java
 *
 * Created on 2010-feb-24, 18:11:39
 */

package dat215projekt.gui.components;

import dat215projekt.data.BaseProductCategory;
import dat215projekt.data.FavoriteListener;
import dat215projekt.data.IMatDataHandlerExtended;
import dat215projekt.gui.components.SettingsPanel;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JTabbedPane;
import javax.swing.JToggleButton;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import se.chalmers.cse.dat215.project.Order;
import se.chalmers.cse.dat215.project.Product;
import se.chalmers.cse.dat215.project.ProductCategory;

public class TabbedPane extends javax.swing.JPanel implements FavoriteListener{
    private static IMatDataHandlerExtended handler = IMatDataHandlerExtended.getInstance();

    private List<Product> activeProducts = new LinkedList<Product>();
    
    public JTabbedPane getPane(){
        return tabPane;
    }

    public JToggleButton getHomeButton1(){
        return homeButton1;
    }

    public JToggleButton getHomeButton3(){
        return homeButton3;
    }

    public JToggleButton getHomeButton4(){
        return homeButton4;
    }

    /** Creates new form TabbedPane */
    public TabbedPane() {
        initComponents();

        
        tabPane.setSelectedIndex(0);
        
        handler.addFavoriteListener(this);
        jScrollPane1.getVerticalScrollBar().setUnitIncrement(70);

        // Create listener
        final ActionListener listener = new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                doClick(e.getActionCommand());
                
            }
        };

        // Put buttons in groups
        ButtonGroup g1 = new ButtonGroup();
        g1.add(breadAndBakeAllButton);
        g1.add(breadButton);
        g1.add(flourSugarSaltButton);
        g1.add(nutsAndSeedsButton);

        ButtonGroup g2 = new ButtonGroup();
        g2.add(fruitVegAllButton);
        g2.add(herbButton);
        g2.add(fruitButton);
        g2.add(melonsButton);
        g2.add(vegButton);
        g2.add(cabbageButton);
        g2.add(exoticFruitButton);
        g2.add(berryButton);
        g2.add(podButton);
        g2.add(citrusFruitButton);

        ButtonGroup g3 = new ButtonGroup();
        g3.add(meatFishDairyAllButton);
        g3.add(meatButton);
        g3.add(fishButton);
        g3.add(dairyButton);

        ButtonGroup g4 = new ButtonGroup();
        g4.add(pastaRicePotatesAllButton);
        g4.add(pastaButton);
        g4.add(potatoRiceButton);
        g4.add(rootVegButton);

        ButtonGroup g5 = new ButtonGroup();
        g5.add(drinksSweetsAllButton);
        g5.add(hotDrinksButton);
        g5.add(coldDrinksButton);
        g5.add(sweetButton);

        ButtonGroup g6 = new ButtonGroup();
        g6.add(homeButton1);
        g6.add(homeButton2);
        g6.add(homeButton3);
        g6.add(homeButton4);

        // Connect listeners to buttons
        breadAndBakeAllButton.addActionListener(listener);
        breadButton.addActionListener(listener);
        flourSugarSaltButton.addActionListener(listener);
        nutsAndSeedsButton.addActionListener(listener);

        fruitVegAllButton.addActionListener(listener);
        herbButton.addActionListener(listener);
        fruitButton.addActionListener(listener);
        melonsButton.addActionListener(listener);
        vegButton.addActionListener(listener);
        cabbageButton.addActionListener(listener);
        exoticFruitButton.addActionListener(listener);
        berryButton.addActionListener(listener);
        podButton.addActionListener(listener);
        citrusFruitButton.addActionListener(listener);

        meatFishDairyAllButton.addActionListener(listener);
        meatButton.addActionListener(listener);
        fishButton.addActionListener(listener);
        dairyButton.addActionListener(listener);

        pastaRicePotatesAllButton.addActionListener(listener);
        pastaButton.addActionListener(listener);
        potatoRiceButton.addActionListener(listener);
        rootVegButton.addActionListener(listener);

        drinksSweetsAllButton.addActionListener(listener);
        hotDrinksButton.addActionListener(listener);
        coldDrinksButton.addActionListener(listener);
        sweetButton.addActionListener(listener);

        tabPane.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                // Just make all "all" buttons selected....
               /* breadAndBakeAllButton.setSelected(true);
                fruitVegAllButton.setSelected(true);
                pastaRicePotatesAllButton.setSelected(true);
                meatFishDairyAllButton.setSelected(true);
                drinksSweetsAllButton.setSelected(true);
*/
                JToggleButton button = null;

                // Get which "all" button to set selected
                switch(tabPane.getSelectedIndex()){
                    case 0: button = homeButton1; break; // Home tab
                    case 1: button = breadAndBakeAllButton; break;
                    case 2: button = fruitVegAllButton; break;
                    case 3: button = pastaRicePotatesAllButton; break;
                    case 4: button = meatFishDairyAllButton; break;
                    case 5: button = drinksSweetsAllButton; break;
                }

                if(button != null){ 
                    button.setSelected(true);
                    doClick(button.getActionCommand());
                }
            }
        });

        // HomeButton actionlisteners
        homeButton1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
               // Visa hem panelen
               /*contentPanel.removeAll();
               contentPanel.add(HomePanel.getInstance());
               contentPanel.revalidate();
               contentPanel.repaint();*/
                doClick("HOME1");
            }
        });

         homeButton2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // orderhistorik
                contentPanel.removeAll();
                contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
                List<Order> orders = handler.getOrders();
                for(int i=0;i<orders.size();i++){
                    contentPanel.add(new OrderPanel(orders.get(i),i));
                }

                contentPanel.revalidate();
                contentPanel.repaint();
            }
        });

         homeButton3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // favoriter
                contentPanel.removeAll();
                contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
                List<Product> favorites = handler.getFavorites();

                for(int i=0;i<favorites.size();i++){
                    contentPanel.add(new ProductPanel(favorites.get(i),i));
                }

                contentPanel.revalidate();
                contentPanel.repaint();
            }
        });

         homeButton4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                contentPanel.removeAll();
                contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
                contentPanel.add(SettingsPanel.getInstance());
                contentPanel.revalidate();
                contentPanel.repaint();
            }
        });
    }

    private void showProducts(List<Product> products){
        jScrollPane1.getVerticalScrollBar().setValue(0);
        
        // Remove old
        contentPanel.removeAll();

        // Set layout
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
        //contentPanel.setLayout(new GridLayout(products.size(),1));
        //contentPanel.setLayout(new FlowLayout());


        for(int i=0;i<products.size();i++){
            contentPanel.add(new ProductPanel(products.get(i),i));
            contentPanel.revalidate();
        contentPanel.repaint();
        }

        activeProducts = products;
        
    }

    public void favoritesChanged() {
        if(tabPane.getSelectedIndex() != 0)
            showProducts(activeProducts);
        else if(homeButton3.isSelected()){
            contentPanel.removeAll();
                contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.PAGE_AXIS));
                List<Product> favorites = handler.getFavorites();

                for(int i=0;i<favorites.size();i++){
                    contentPanel.add(new ProductPanel(favorites.get(i),i));
                }

                contentPanel.revalidate();
                contentPanel.repaint();
        }
    }

    // Determine which tab we are on
    private BaseProductCategory getSelectedBaseCategory(){
        switch(tabPane.getSelectedIndex()){
            case 0: return null; // Home tab
            case 1: return BaseProductCategory.BREAD_BAKE;
            case 2: return BaseProductCategory.FRUIT_VEG;
            case 3: return BaseProductCategory.PASTA_RICE_POTATOES;
            case 4: return BaseProductCategory.MEAT_FISH_DAIRY;
            case 5: return BaseProductCategory.DRINKS_SWEETS;
            default: throw new IllegalStateException("NO TAB SELECTED?");
        }
    }

    public void doClick(String actionCommand){

        if(actionCommand.equals("HOME1")){
             // Visa hem panelen
               contentPanel.removeAll();
               contentPanel.setLayout(new GridLayout(1,1));
               contentPanel.add(HomePanel.getInstance());
               contentPanel.revalidate();
               contentPanel.repaint();
        }
        else if(actionCommand.equals("ALL")){
            BaseProductCategory c = getSelectedBaseCategory();
            showProducts(handler.getProducts(c));
        }
        else{
            // show products from selected category
            ProductCategory c = ProductCategory.valueOf(actionCommand);
            showProducts(handler.getProducts(c));
        }
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tabPane = new javax.swing.JTabbedPane();
        homePanel = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        homeButton1 = new javax.swing.JToggleButton();
        homeButton2 = new javax.swing.JToggleButton();
        homeButton3 = new javax.swing.JToggleButton();
        homeButton4 = new javax.swing.JToggleButton();
        breadPanel = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        breadAndBakeAllButton = new javax.swing.JToggleButton();
        breadButton = new javax.swing.JToggleButton();
        flourSugarSaltButton = new javax.swing.JToggleButton();
        nutsAndSeedsButton = new javax.swing.JToggleButton();
        fruitPanel = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        fruitVegAllButton = new javax.swing.JToggleButton();
        herbButton = new javax.swing.JToggleButton();
        fruitButton = new javax.swing.JToggleButton();
        melonsButton = new javax.swing.JToggleButton();
        vegButton = new javax.swing.JToggleButton();
        cabbageButton = new javax.swing.JToggleButton();
        exoticFruitButton = new javax.swing.JToggleButton();
        berryButton = new javax.swing.JToggleButton();
        podButton = new javax.swing.JToggleButton();
        citrusFruitButton = new javax.swing.JToggleButton();
        pastaPanel = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        pastaRicePotatesAllButton = new javax.swing.JToggleButton();
        pastaButton = new javax.swing.JToggleButton();
        potatoRiceButton = new javax.swing.JToggleButton();
        rootVegButton = new javax.swing.JToggleButton();
        meatPanel = new javax.swing.JPanel();
        jPanel11 = new javax.swing.JPanel();
        meatFishDairyAllButton = new javax.swing.JToggleButton();
        meatButton = new javax.swing.JToggleButton();
        fishButton = new javax.swing.JToggleButton();
        dairyButton = new javax.swing.JToggleButton();
        drinkPanel = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        drinksSweetsAllButton = new javax.swing.JToggleButton();
        hotDrinksButton = new javax.swing.JToggleButton();
        coldDrinksButton = new javax.swing.JToggleButton();
        sweetButton = new javax.swing.JToggleButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        contentPanel = new javax.swing.JPanel();
        homePanel1 = new dat215projekt.gui.components.HomePanel();

        setName("Form"); // NOI18N
        setOpaque(false);

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(dat215projekt.Dat215projektApp.class).getContext().getResourceMap(TabbedPane.class);
        tabPane.setBackground(resourceMap.getColor("tabPane.background")); // NOI18N
        tabPane.setMaximumSize(new java.awt.Dimension(600, 32767));
        tabPane.setMinimumSize(new java.awt.Dimension(132, 37));
        tabPane.setName("tabPane"); // NOI18N
        tabPane.setPreferredSize(new java.awt.Dimension(600, 37));

        homePanel.setName("homePanel"); // NOI18N

        jPanel7.setBackground(resourceMap.getColor("jPanel7.background")); // NOI18N
        jPanel7.setMinimumSize(new java.awt.Dimension(585, 45));
        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setPreferredSize(new java.awt.Dimension(622, 45));
        jPanel7.setRequestFocusEnabled(false);
        jPanel7.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        homeButton1.setIcon(resourceMap.getIcon("homeButton1.icon")); // NOI18N
        homeButton1.setText(resourceMap.getString("homeButton1.text")); // NOI18N
        homeButton1.setActionCommand(resourceMap.getString("homeButton1.actionCommand")); // NOI18N
        homeButton1.setBorderPainted(false);
        homeButton1.setContentAreaFilled(false);
        homeButton1.setName("homeButton1"); // NOI18N
        homeButton1.setSelectedIcon(resourceMap.getIcon("homeButton1.selectedIcon")); // NOI18N
        jPanel7.add(homeButton1);

        homeButton2.setIcon(resourceMap.getIcon("homeButton2.icon")); // NOI18N
        homeButton2.setText(resourceMap.getString("homeButton2.text")); // NOI18N
        homeButton2.setBorderPainted(false);
        homeButton2.setContentAreaFilled(false);
        homeButton2.setName("homeButton2"); // NOI18N
        homeButton2.setSelectedIcon(resourceMap.getIcon("homeButton2.selectedIcon")); // NOI18N
        jPanel7.add(homeButton2);

        homeButton3.setIcon(resourceMap.getIcon("homeButton3.icon")); // NOI18N
        homeButton3.setText(resourceMap.getString("homeButton3.text")); // NOI18N
        homeButton3.setBorderPainted(false);
        homeButton3.setContentAreaFilled(false);
        homeButton3.setName("homeButton3"); // NOI18N
        homeButton3.setSelectedIcon(resourceMap.getIcon("StartButton2.selectedIcon")); // NOI18N
        jPanel7.add(homeButton3);

        homeButton4.setIcon(resourceMap.getIcon("homeButton4.icon")); // NOI18N
        homeButton4.setText(resourceMap.getString("homeButton4.text")); // NOI18N
        homeButton4.setBorderPainted(false);
        homeButton4.setContentAreaFilled(false);
        homeButton4.setName("homeButton4"); // NOI18N
        homeButton4.setSelectedIcon(resourceMap.getIcon("homeButton4.selectedIcon")); // NOI18N
        jPanel7.add(homeButton4);

        javax.swing.GroupLayout homePanelLayout = new javax.swing.GroupLayout(homePanel);
        homePanel.setLayout(homePanelLayout);
        homePanelLayout.setHorizontalGroup(
            homePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE)
        );
        homePanelLayout.setVerticalGroup(
            homePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
        );

        tabPane.addTab(resourceMap.getString("homePanel.TabConstraints.tabTitle"), resourceMap.getIcon("homePanel.TabConstraints.tabIcon"), homePanel); // NOI18N

        breadPanel.setName("breadPanel"); // NOI18N

        jPanel8.setBackground(resourceMap.getColor("jPanel8.background")); // NOI18N
        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setPreferredSize(new java.awt.Dimension(622, 45));
        jPanel8.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        breadAndBakeAllButton.setIcon(resourceMap.getIcon("breadAndBakeAllButton.icon")); // NOI18N
        breadAndBakeAllButton.setText(resourceMap.getString("breadAndBakeAllButton.text")); // NOI18N
        breadAndBakeAllButton.setActionCommand(resourceMap.getString("breadAndBakeAllButton.actionCommand")); // NOI18N
        breadAndBakeAllButton.setBorderPainted(false);
        breadAndBakeAllButton.setContentAreaFilled(false);
        breadAndBakeAllButton.setName("breadAndBakeAllButton"); // NOI18N
        breadAndBakeAllButton.setSelectedIcon(resourceMap.getIcon("breadAndBakeAllButton.selectedIcon")); // NOI18N
        jPanel8.add(breadAndBakeAllButton);

        breadButton.setIcon(resourceMap.getIcon("breadButton.icon")); // NOI18N
        breadButton.setText(resourceMap.getString("breadButton.text")); // NOI18N
        breadButton.setActionCommand(resourceMap.getString("breadButton.actionCommand")); // NOI18N
        breadButton.setBorderPainted(false);
        breadButton.setContentAreaFilled(false);
        breadButton.setName("breadButton"); // NOI18N
        breadButton.setSelectedIcon(resourceMap.getIcon("breadButton.selectedIcon")); // NOI18N
        jPanel8.add(breadButton);

        flourSugarSaltButton.setIcon(resourceMap.getIcon("flourSugarSaltButton.icon")); // NOI18N
        flourSugarSaltButton.setText(resourceMap.getString("flourSugarSaltButton.text")); // NOI18N
        flourSugarSaltButton.setActionCommand(resourceMap.getString("flourSugarSaltButton.actionCommand")); // NOI18N
        flourSugarSaltButton.setBorderPainted(false);
        flourSugarSaltButton.setContentAreaFilled(false);
        flourSugarSaltButton.setName("flourSugarSaltButton"); // NOI18N
        flourSugarSaltButton.setSelectedIcon(resourceMap.getIcon("flourSugarSaltButton.selectedIcon")); // NOI18N
        jPanel8.add(flourSugarSaltButton);

        nutsAndSeedsButton.setIcon(resourceMap.getIcon("nutsAndSeedsButton.icon")); // NOI18N
        nutsAndSeedsButton.setText(resourceMap.getString("nutsAndSeedsButton.text")); // NOI18N
        nutsAndSeedsButton.setActionCommand(resourceMap.getString("nutsAndSeedsButton.actionCommand")); // NOI18N
        nutsAndSeedsButton.setBorderPainted(false);
        nutsAndSeedsButton.setContentAreaFilled(false);
        nutsAndSeedsButton.setName("nutsAndSeedsButton"); // NOI18N
        nutsAndSeedsButton.setSelectedIcon(resourceMap.getIcon("nutsAndSeedsButton.selectedIcon")); // NOI18N
        jPanel8.add(nutsAndSeedsButton);

        javax.swing.GroupLayout breadPanelLayout = new javax.swing.GroupLayout(breadPanel);
        breadPanel.setLayout(breadPanelLayout);
        breadPanelLayout.setHorizontalGroup(
            breadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE)
        );
        breadPanelLayout.setVerticalGroup(
            breadPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
        );

        tabPane.addTab(resourceMap.getString("breadPanel.TabConstraints.tabTitle"), resourceMap.getIcon("breadPanel.TabConstraints.tabIcon"), breadPanel); // NOI18N

        fruitPanel.setName("fruitPanel"); // NOI18N

        jPanel9.setBackground(resourceMap.getColor("jPanel9.background")); // NOI18N
        jPanel9.setMaximumSize(new java.awt.Dimension(600, 32767));
        jPanel9.setMinimumSize(new java.awt.Dimension(600, 44));
        jPanel9.setName("jPanel9"); // NOI18N
        jPanel9.setPreferredSize(new java.awt.Dimension(600, 45));
        jPanel9.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        fruitVegAllButton.setIcon(resourceMap.getIcon("fruitVegAllButton.icon")); // NOI18N
        fruitVegAllButton.setText(resourceMap.getString("fruitVegAllButton.text")); // NOI18N
        fruitVegAllButton.setActionCommand(resourceMap.getString("fruitVegAllButton.actionCommand")); // NOI18N
        fruitVegAllButton.setBorderPainted(false);
        fruitVegAllButton.setContentAreaFilled(false);
        fruitVegAllButton.setName("fruitVegAllButton"); // NOI18N
        fruitVegAllButton.setPreferredSize(new java.awt.Dimension(79, 25));
        fruitVegAllButton.setSelectedIcon(resourceMap.getIcon("fruitVegAllButton.selectedIcon")); // NOI18N
        jPanel9.add(fruitVegAllButton);

        herbButton.setIcon(resourceMap.getIcon("herbButton.icon")); // NOI18N
        herbButton.setText(resourceMap.getString("herbButton.text")); // NOI18N
        herbButton.setActionCommand(resourceMap.getString("herbButton.actionCommand")); // NOI18N
        herbButton.setBorderPainted(false);
        herbButton.setContentAreaFilled(false);
        herbButton.setName("herbButton"); // NOI18N
        herbButton.setPreferredSize(new java.awt.Dimension(139, 25));
        herbButton.setSelectedIcon(resourceMap.getIcon("herbButton.selectedIcon")); // NOI18N
        jPanel9.add(herbButton);

        fruitButton.setIcon(resourceMap.getIcon("fruitButton.icon")); // NOI18N
        fruitButton.setText(resourceMap.getString("fruitButton.text")); // NOI18N
        fruitButton.setActionCommand(resourceMap.getString("fruitButton.actionCommand")); // NOI18N
        fruitButton.setBorderPainted(false);
        fruitButton.setContentAreaFilled(false);
        fruitButton.setName("fruitButton"); // NOI18N
        fruitButton.setPreferredSize(new java.awt.Dimension(139, 25));
        fruitButton.setSelectedIcon(resourceMap.getIcon("fruitButton.selectedIcon")); // NOI18N
        jPanel9.add(fruitButton);

        melonsButton.setIcon(resourceMap.getIcon("melonsButton.icon")); // NOI18N
        melonsButton.setText(resourceMap.getString("melonsButton.text")); // NOI18N
        melonsButton.setActionCommand(resourceMap.getString("melonsButton.actionCommand")); // NOI18N
        melonsButton.setBorderPainted(false);
        melonsButton.setContentAreaFilled(false);
        melonsButton.setName("melonsButton"); // NOI18N
        melonsButton.setPreferredSize(new java.awt.Dimension(139, 25));
        melonsButton.setSelectedIcon(resourceMap.getIcon("melonsButton.selectedIcon")); // NOI18N
        jPanel9.add(melonsButton);

        vegButton.setIcon(resourceMap.getIcon("vegButton.icon")); // NOI18N
        vegButton.setText(resourceMap.getString("vegButton.text")); // NOI18N
        vegButton.setActionCommand(resourceMap.getString("vegButton.actionCommand")); // NOI18N
        vegButton.setBorderPainted(false);
        vegButton.setContentAreaFilled(false);
        vegButton.setName("vegButton"); // NOI18N
        vegButton.setPreferredSize(new java.awt.Dimension(139, 25));
        vegButton.setSelectedIcon(resourceMap.getIcon("vegButton.selectedIcon")); // NOI18N
        jPanel9.add(vegButton);

        cabbageButton.setIcon(resourceMap.getIcon("cabbageButton.icon")); // NOI18N
        cabbageButton.setText(resourceMap.getString("cabbageButton.text")); // NOI18N
        cabbageButton.setActionCommand(resourceMap.getString("cabbageButton.actionCommand")); // NOI18N
        cabbageButton.setBorderPainted(false);
        cabbageButton.setContentAreaFilled(false);
        cabbageButton.setName("cabbageButton"); // NOI18N
        cabbageButton.setPreferredSize(new java.awt.Dimension(79, 25));
        cabbageButton.setSelectedIcon(resourceMap.getIcon("cabbageButton.selectedIcon")); // NOI18N
        jPanel9.add(cabbageButton);

        exoticFruitButton.setIcon(resourceMap.getIcon("exoticFruitButton.icon")); // NOI18N
        exoticFruitButton.setText(resourceMap.getString("exoticFruitButton.text")); // NOI18N
        exoticFruitButton.setActionCommand(resourceMap.getString("exoticFruitButton.actionCommand")); // NOI18N
        exoticFruitButton.setBorderPainted(false);
        exoticFruitButton.setContentAreaFilled(false);
        exoticFruitButton.setName("exoticFruitButton"); // NOI18N
        exoticFruitButton.setPreferredSize(new java.awt.Dimension(139, 25));
        exoticFruitButton.setSelectedIcon(resourceMap.getIcon("exoticFruitButton.selectedIcon")); // NOI18N
        jPanel9.add(exoticFruitButton);

        berryButton.setIcon(resourceMap.getIcon("berryButton.icon")); // NOI18N
        berryButton.setText(resourceMap.getString("berryButton.text")); // NOI18N
        berryButton.setActionCommand(resourceMap.getString("berryButton.actionCommand")); // NOI18N
        berryButton.setBorderPainted(false);
        berryButton.setContentAreaFilled(false);
        berryButton.setName("berryButton"); // NOI18N
        berryButton.setPreferredSize(new java.awt.Dimension(79, 25));
        berryButton.setSelectedIcon(resourceMap.getIcon("berryButton.selectedIcon")); // NOI18N
        jPanel9.add(berryButton);

        podButton.setIcon(resourceMap.getIcon("podButton.icon")); // NOI18N
        podButton.setText(resourceMap.getString("podButton.text")); // NOI18N
        podButton.setActionCommand(resourceMap.getString("podButton.actionCommand")); // NOI18N
        podButton.setBorderPainted(false);
        podButton.setContentAreaFilled(false);
        podButton.setName("podButton"); // NOI18N
        podButton.setPreferredSize(new java.awt.Dimension(139, 25));
        podButton.setSelectedIcon(resourceMap.getIcon("podButton.selectedIcon")); // NOI18N
        jPanel9.add(podButton);

        citrusFruitButton.setIcon(resourceMap.getIcon("citrusFruitButton.icon")); // NOI18N
        citrusFruitButton.setText(resourceMap.getString("citrusFruitButton.text")); // NOI18N
        citrusFruitButton.setActionCommand(resourceMap.getString("citrusFruitButton.actionCommand")); // NOI18N
        citrusFruitButton.setBorderPainted(false);
        citrusFruitButton.setContentAreaFilled(false);
        citrusFruitButton.setName("citrusFruitButton"); // NOI18N
        citrusFruitButton.setPreferredSize(new java.awt.Dimension(139, 25));
        citrusFruitButton.setSelectedIcon(resourceMap.getIcon("citrusFruitButton.selectedIcon")); // NOI18N
        jPanel9.add(citrusFruitButton);

        javax.swing.GroupLayout fruitPanelLayout = new javax.swing.GroupLayout(fruitPanel);
        fruitPanel.setLayout(fruitPanelLayout);
        fruitPanelLayout.setHorizontalGroup(
            fruitPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 759, Short.MAX_VALUE)
            .addGroup(fruitPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE))
        );
        fruitPanelLayout.setVerticalGroup(
            fruitPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 55, Short.MAX_VALUE)
            .addGroup(fruitPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE))
        );

        tabPane.addTab(resourceMap.getString("fruitPanel.TabConstraints.tabTitle"), resourceMap.getIcon("fruitPanel.TabConstraints.tabIcon"), fruitPanel); // NOI18N

        pastaPanel.setName("pastaPanel"); // NOI18N

        jPanel10.setBackground(resourceMap.getColor("jPanel10.background")); // NOI18N
        jPanel10.setName("jPanel10"); // NOI18N
        jPanel10.setPreferredSize(new java.awt.Dimension(1455, 45));
        jPanel10.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        pastaRicePotatesAllButton.setIcon(resourceMap.getIcon("pastaRicePotatesAllButton.icon")); // NOI18N
        pastaRicePotatesAllButton.setText(resourceMap.getString("pastaRicePotatesAllButton.text")); // NOI18N
        pastaRicePotatesAllButton.setActionCommand(resourceMap.getString("pastaRicePotatesAllButton.actionCommand")); // NOI18N
        pastaRicePotatesAllButton.setBorderPainted(false);
        pastaRicePotatesAllButton.setContentAreaFilled(false);
        pastaRicePotatesAllButton.setName("pastaRicePotatesAllButton"); // NOI18N
        pastaRicePotatesAllButton.setSelectedIcon(resourceMap.getIcon("pastaRicePotatesAllButton.selectedIcon")); // NOI18N
        jPanel10.add(pastaRicePotatesAllButton);

        pastaButton.setIcon(resourceMap.getIcon("pastaButton.icon")); // NOI18N
        pastaButton.setText(resourceMap.getString("pastaButton.text")); // NOI18N
        pastaButton.setActionCommand(resourceMap.getString("pastaButton.actionCommand")); // NOI18N
        pastaButton.setBorderPainted(false);
        pastaButton.setContentAreaFilled(false);
        pastaButton.setName("pastaButton"); // NOI18N
        pastaButton.setSelectedIcon(resourceMap.getIcon("pastaButton.selectedIcon")); // NOI18N
        jPanel10.add(pastaButton);

        potatoRiceButton.setIcon(resourceMap.getIcon("potatoRiceButton.icon")); // NOI18N
        potatoRiceButton.setText(resourceMap.getString("potatoRiceButton.text")); // NOI18N
        potatoRiceButton.setActionCommand(resourceMap.getString("potatoRiceButton.actionCommand")); // NOI18N
        potatoRiceButton.setBorderPainted(false);
        potatoRiceButton.setContentAreaFilled(false);
        potatoRiceButton.setName("potatoRiceButton"); // NOI18N
        potatoRiceButton.setSelectedIcon(resourceMap.getIcon("potatoRiceButton.selectedIcon")); // NOI18N
        jPanel10.add(potatoRiceButton);

        rootVegButton.setIcon(resourceMap.getIcon("rootVegButton.icon")); // NOI18N
        rootVegButton.setText(resourceMap.getString("rootVegButton.text")); // NOI18N
        rootVegButton.setActionCommand(resourceMap.getString("rootVegButton.actionCommand")); // NOI18N
        rootVegButton.setBorderPainted(false);
        rootVegButton.setContentAreaFilled(false);
        rootVegButton.setName("rootVegButton"); // NOI18N
        rootVegButton.setSelectedIcon(resourceMap.getIcon("rootVegButton.selectedIcon")); // NOI18N
        jPanel10.add(rootVegButton);

        javax.swing.GroupLayout pastaPanelLayout = new javax.swing.GroupLayout(pastaPanel);
        pastaPanel.setLayout(pastaPanelLayout);
        pastaPanelLayout.setHorizontalGroup(
            pastaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE)
        );
        pastaPanelLayout.setVerticalGroup(
            pastaPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
        );

        tabPane.addTab(resourceMap.getString("pastaPanel.TabConstraints.tabTitle"), resourceMap.getIcon("pastaPanel.TabConstraints.tabIcon"), pastaPanel); // NOI18N

        meatPanel.setName("meatPanel"); // NOI18N

        jPanel11.setBackground(resourceMap.getColor("jPanel11.background")); // NOI18N
        jPanel11.setName("jPanel11"); // NOI18N
        jPanel11.setPreferredSize(new java.awt.Dimension(1455, 45));
        jPanel11.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        meatFishDairyAllButton.setIcon(resourceMap.getIcon("meatFishDairyAllButton.icon")); // NOI18N
        meatFishDairyAllButton.setText(resourceMap.getString("meatFishDairyAllButton.text")); // NOI18N
        meatFishDairyAllButton.setActionCommand(resourceMap.getString("meatFishDairyAllButton.actionCommand")); // NOI18N
        meatFishDairyAllButton.setBorderPainted(false);
        meatFishDairyAllButton.setContentAreaFilled(false);
        meatFishDairyAllButton.setName("meatFishDairyAllButton"); // NOI18N
        meatFishDairyAllButton.setSelectedIcon(resourceMap.getIcon("meatFishDairyAllButton.selectedIcon")); // NOI18N
        jPanel11.add(meatFishDairyAllButton);

        meatButton.setIcon(resourceMap.getIcon("meatButton.icon")); // NOI18N
        meatButton.setText(resourceMap.getString("meatButton.text")); // NOI18N
        meatButton.setActionCommand(resourceMap.getString("meatButton.actionCommand")); // NOI18N
        meatButton.setBorderPainted(false);
        meatButton.setContentAreaFilled(false);
        meatButton.setName("meatButton"); // NOI18N
        meatButton.setSelectedIcon(resourceMap.getIcon("meatButton.selectedIcon")); // NOI18N
        jPanel11.add(meatButton);

        fishButton.setIcon(resourceMap.getIcon("fishButton.icon")); // NOI18N
        fishButton.setText(resourceMap.getString("fishButton.text")); // NOI18N
        fishButton.setActionCommand(resourceMap.getString("fishButton.actionCommand")); // NOI18N
        fishButton.setBorderPainted(false);
        fishButton.setContentAreaFilled(false);
        fishButton.setName("fishButton"); // NOI18N
        fishButton.setSelectedIcon(resourceMap.getIcon("fishButton.selectedIcon")); // NOI18N
        jPanel11.add(fishButton);

        dairyButton.setIcon(resourceMap.getIcon("dairyButton.icon")); // NOI18N
        dairyButton.setText(resourceMap.getString("dairyButton.text")); // NOI18N
        dairyButton.setActionCommand(resourceMap.getString("dairyButton.actionCommand")); // NOI18N
        dairyButton.setBorderPainted(false);
        dairyButton.setContentAreaFilled(false);
        dairyButton.setName("dairyButton"); // NOI18N
        dairyButton.setSelectedIcon(resourceMap.getIcon("dairyButton.selectedIcon")); // NOI18N
        jPanel11.add(dairyButton);

        javax.swing.GroupLayout meatPanelLayout = new javax.swing.GroupLayout(meatPanel);
        meatPanel.setLayout(meatPanelLayout);
        meatPanelLayout.setHorizontalGroup(
            meatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 759, Short.MAX_VALUE)
            .addGroup(meatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE))
        );
        meatPanelLayout.setVerticalGroup(
            meatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 55, Short.MAX_VALUE)
            .addGroup(meatPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE))
        );

        tabPane.addTab(resourceMap.getString("meatPanel.TabConstraints.tabTitle"), resourceMap.getIcon("meatPanel.TabConstraints.tabIcon"), meatPanel); // NOI18N

        drinkPanel.setName("drinkPanel"); // NOI18N

        jPanel12.setBackground(resourceMap.getColor("jPanel12.background")); // NOI18N
        jPanel12.setName("jPanel12"); // NOI18N
        jPanel12.setPreferredSize(new java.awt.Dimension(1455, 45));
        jPanel12.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 0));

        drinksSweetsAllButton.setIcon(resourceMap.getIcon("drinksSweetsAllButton.icon")); // NOI18N
        drinksSweetsAllButton.setText(resourceMap.getString("drinksSweetsAllButton.text")); // NOI18N
        drinksSweetsAllButton.setActionCommand(resourceMap.getString("drinksSweetsAllButton.actionCommand")); // NOI18N
        drinksSweetsAllButton.setBorderPainted(false);
        drinksSweetsAllButton.setContentAreaFilled(false);
        drinksSweetsAllButton.setName("drinksSweetsAllButton"); // NOI18N
        drinksSweetsAllButton.setSelectedIcon(resourceMap.getIcon("drinksSweetsAllButton.selectedIcon")); // NOI18N
        jPanel12.add(drinksSweetsAllButton);

        hotDrinksButton.setIcon(resourceMap.getIcon("hotDrinksButton.icon")); // NOI18N
        hotDrinksButton.setText(resourceMap.getString("hotDrinksButton.text")); // NOI18N
        hotDrinksButton.setActionCommand(resourceMap.getString("hotDrinksButton.actionCommand")); // NOI18N
        hotDrinksButton.setBorderPainted(false);
        hotDrinksButton.setContentAreaFilled(false);
        hotDrinksButton.setName("hotDrinksButton"); // NOI18N
        hotDrinksButton.setSelectedIcon(resourceMap.getIcon("hotDrinksButton.selectedIcon")); // NOI18N
        jPanel12.add(hotDrinksButton);

        coldDrinksButton.setIcon(resourceMap.getIcon("coldDrinksButton.icon")); // NOI18N
        coldDrinksButton.setText(resourceMap.getString("coldDrinksButton.text")); // NOI18N
        coldDrinksButton.setActionCommand(resourceMap.getString("coldDrinksButton.actionCommand")); // NOI18N
        coldDrinksButton.setBorderPainted(false);
        coldDrinksButton.setContentAreaFilled(false);
        coldDrinksButton.setName("coldDrinksButton"); // NOI18N
        coldDrinksButton.setSelectedIcon(resourceMap.getIcon("coldDrinksButton.selectedIcon")); // NOI18N
        jPanel12.add(coldDrinksButton);

        sweetButton.setIcon(resourceMap.getIcon("sweetButton.icon")); // NOI18N
        sweetButton.setText(resourceMap.getString("sweetButton.text")); // NOI18N
        sweetButton.setActionCommand(resourceMap.getString("sweetButton.actionCommand")); // NOI18N
        sweetButton.setBorderPainted(false);
        sweetButton.setContentAreaFilled(false);
        sweetButton.setName("sweetButton"); // NOI18N
        sweetButton.setSelectedIcon(resourceMap.getIcon("sweetButton.selectedIcon")); // NOI18N
        jPanel12.add(sweetButton);

        javax.swing.GroupLayout drinkPanelLayout = new javax.swing.GroupLayout(drinkPanel);
        drinkPanel.setLayout(drinkPanelLayout);
        drinkPanelLayout.setHorizontalGroup(
            drinkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, 759, Short.MAX_VALUE)
        );
        drinkPanelLayout.setVerticalGroup(
            drinkPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)
        );

        tabPane.addTab(resourceMap.getString("drinkPanel.TabConstraints.tabTitle"), resourceMap.getIcon("drinkPanel.TabConstraints.tabIcon"), drinkPanel); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        contentPanel.setBackground(resourceMap.getColor("contentPanel.background")); // NOI18N
        contentPanel.setName("contentPanel"); // NOI18N
        contentPanel.setLayout(new javax.swing.BoxLayout(contentPanel, javax.swing.BoxLayout.PAGE_AXIS));

        homePanel1.setName("homePanel1"); // NOI18N
        contentPanel.add(homePanel1);

        jScrollPane1.setViewportView(contentPanel);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(tabPane, javax.swing.GroupLayout.DEFAULT_SIZE, 764, Short.MAX_VALUE)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 764, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(tabPane, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToggleButton berryButton;
    private javax.swing.JToggleButton breadAndBakeAllButton;
    private javax.swing.JToggleButton breadButton;
    private javax.swing.JPanel breadPanel;
    private javax.swing.JToggleButton cabbageButton;
    private javax.swing.JToggleButton citrusFruitButton;
    private javax.swing.JToggleButton coldDrinksButton;
    private javax.swing.JPanel contentPanel;
    private javax.swing.JToggleButton dairyButton;
    private javax.swing.JPanel drinkPanel;
    private javax.swing.JToggleButton drinksSweetsAllButton;
    private javax.swing.JToggleButton exoticFruitButton;
    private javax.swing.JToggleButton fishButton;
    private javax.swing.JToggleButton flourSugarSaltButton;
    private javax.swing.JToggleButton fruitButton;
    private javax.swing.JPanel fruitPanel;
    private javax.swing.JToggleButton fruitVegAllButton;
    private javax.swing.JToggleButton herbButton;
    private javax.swing.JToggleButton homeButton1;
    private javax.swing.JToggleButton homeButton2;
    private javax.swing.JToggleButton homeButton3;
    private javax.swing.JToggleButton homeButton4;
    private javax.swing.JPanel homePanel;
    private dat215projekt.gui.components.HomePanel homePanel1;
    private javax.swing.JToggleButton hotDrinksButton;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToggleButton meatButton;
    private javax.swing.JToggleButton meatFishDairyAllButton;
    private javax.swing.JPanel meatPanel;
    private javax.swing.JToggleButton melonsButton;
    private javax.swing.JToggleButton nutsAndSeedsButton;
    private javax.swing.JToggleButton pastaButton;
    private javax.swing.JPanel pastaPanel;
    private javax.swing.JToggleButton pastaRicePotatesAllButton;
    private javax.swing.JToggleButton podButton;
    private javax.swing.JToggleButton potatoRiceButton;
    private javax.swing.JToggleButton rootVegButton;
    private javax.swing.JToggleButton sweetButton;
    private javax.swing.JTabbedPane tabPane;
    private javax.swing.JToggleButton vegButton;
    // End of variables declaration//GEN-END:variables

}
